{include mobadmin.inc.header}
<!--tmpl-resource-->
<link href="/res/offer/mobadmin/css/common.css" rel="stylesheet" type="text/css" />
<link href="/res/offer/mobadmin/css/animate.css" rel="stylesheet" type="text/css" />
    <style>

        .bjtable{ width:100%;border-collapse: collapse; }
        /*.bjtable thead {padding-bottom: 20px;} */
        .bjtable li{height: 43px;vertical-align:middle;border-bottom: 1px solid #f0f0f0;}
        .bjtable li.tb_head{ font-size: 0.543rem;height:45px;line-height:45px; background: #fff;color: #999;border: none;}
        .bjtable li.blank15{height: 15px;background: #f2f2f2;}
        .bjtable li span{float: left;display: inline;text-align: center;color: #999;}
        .bjtable li span.w28, .bjtable li span.w27{line-height: 43px;}
        .bjtable li span input{color: #999;}
        .bjtable li.tb_head em{ font-style: normal;font-size: 0.391rem;}
        .bjtable li.tb_head span{}
        .bjtable .addBjInp{ width:3rem;vertical-align: middle;margin:0px;padding:0px;font-size: 0.565rem;outline: none;border: none;margin-top: -0.2rem;text-align: center;ime-mode:disabled; }
        .bjtable .pinmingCol{height: 43px;font-size: 0.565rem;color: #bababa;display: table-cell;vertical-align: middle;}
        .bjtable .pinmingCol span{float: none;color: #666;}
        .bjtable li.tb_row{position: relative;}
        .bjtable li.tb_row span.w45{display: table;}
        .bjtable li.tb_row span.w45,.bjtable li.tb_row span.w27{position: relative;}
        .bjtable li.tb_row span.w45:after{content: "|";display: inline-block;font-size: 20px;color: #efefef;display: inline-block;position: absolute;top: 7px;right: 0;}
        .bjtable li.tb_row span.w27:before{content: "|";display: inline-block;font-size: 20px;color: #efefef;display: inline-block;position: absolute;left: 0;}
        .bjtable li.tb_row span.cancel,.bjtable li.tb_row span.delete{width: 50%;height: 43px;line-height: 43px;font-size: 14px;border-bottom: 1px solid #efefef;}
        .bjtable li.tb_row span.cancel{background: #dedede;color: #666;}
        .bjtable li.tb_row span.delete{background: #ff0000;color: #fff;}
        .bjtable li.tb_row .formdata{width: 100%;overflow: hidden;}
        .bjtable li.tb_row .btn{width: 40%;position: absolute;top: 0;left: 100%;}

        .ucTopBar{ height: 1.956rem;line-height: 1.965rem;background: #2f8aff;overflow: hidden;}
        .uctbLeft{ float: left;margin-left:0.652rem;font-size: 0.782rem;color:#fff; }
        .uctbRight{ float: right;margin:0rem 0.652rem; }
        .ucIcon{ display: inline-block;vertical-align: middle;height: 1.1rem;line-height: 1.1rem;width:1.1rem;background: url("") no-repeat;background-size: 100%;}

        .ucTxt{ vertical-align: middle;font-size:0.782rem;color:#fff;  }

        .addBJRow{ background: #fff;}
        .modifyInp{ display: inline;vertical-align: middle;font-size:0.652rem;
            outline: none;    padding: 0.5rem 0.2rem;
            -webkit-appearance: none; /*去除系统默认的样式*/
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0); /* 点击高亮的颜色*/}
        .baojiaRight{ margin-left: 1rem;}
        .baojiaInfoEdit .baojiaRow{ height: 1.8rem;line-height: 1.8rem;overflow: hidden;border-bottom: 1px solid #efefef;margin: 0rem 0.652rem;}
        .baojiaInfoEdit .baojiaRow .baojiaLabel{ color: #333; }

        .addPhoneBtn,.delPhoneBtn{ width:0.869rem;height: 0.869rem;display: inline-block;vertical-align: middle;}
        .addPhoneBtn{ background: url("") no-repeat;background-size: 100%; }
        .delPhoneBtn{  background: url("") no-repeat;background-size: 100%;}
        .shareSuccessPanel{ position: fixed;top:0px;left: 0px;right: 0px;bottom: 0px;background: url( /res/offer/mobadmin/images/shareSuccess.png) no-repeat;
            background-color: rgba(0,0,0,0.7);background-size: 100% auto;display: none;z-index: 2;
        }
        .addBJ .modifyBtn{ margin-right: 0rem; }
        .selectTxtWrap{ margin-right: 1rem;text-overflow: ellipsis;
    overflow: hidden;   }
        .selectOn{ height: auto;}
        .selectOn .selectTxtWrap{ white-space: normal;overflow: auto;}

        .back{}

        .addBJ .pinmingColSel{ color: #333;height: 43px;white-space: pre-wrap;}

        .selectRow .radioBtn{ display: none; }
    </style>
    <style>

        .braPanel{width: 100%;position: fixed;top:0rem;left:0rem;background: #fff; z-index:100;bottom:0rem;-webkit-transform: translate3d(2000px, 0, 0); transform: translate3d(2000px, 0, 0);}

        .braContent{height:70%;overflow: scroll;position: relative;z-index: 100;background: #fff;}
        .grayBtn{  color: #b9b9b9;border-color: #b9b9b9;}
        .modifyInp { width:12rem;border:none;}

        .customRow{ text-align: center;height: 1.6rem;line-height: 1.6rem;position: absolute; width: 100%;bottom: 0.5rem;}
        .customRow .customLink{height: 25px;line-height: 25px;color: #308bfe;font-size: 15px;display: block;margin: 0 15px;border: 1px solid #2f8aff;border-radius: 20px;}
        .baojiaRow .baojiaLeft{ text-align: left;width:1rem; }
        .baojiaInfo{ padding:0rem; }
        .baojiaIcon{ display: inline-block;width:0.782rem;height: 0.782rem;vertical-align: middle;}
       .braPanelBounceIn{     -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0); }
        .w45{width: 45%;}
        .w28{width: 28%;}
        .w27{width: 27%;}
        .fl{float: left;display: inline;}



    </style>


        <div class="shareSuccessPanel"></div>
        <div class="ucTopBar">
            <div class="uctbLeft">塑料报价</div>
            <a href="/mobadmin/index/index" class="uctbRight">
                <span class="ucIcon"></span>
                <span class="ucTxt">我的</span>
            </a>
        </div>

        <div class="masker" style="display: none"></div>

        <div class="addBJRow">
            <div class="addBJ">
                <div class="braPanel tpfb_panel animated" >
                    <div class="back"><a href="javascript:void(0)" class="panelClose"></a></div>
                    <div class="searchRow">
                        <input class="serchInp" />
                        <a href="#" class="searchBtn">搜索</a>
                        <div class="searchPop">
                            <span class="searchIcon"></span> <span class="searchPsTxt">品名/厂家/牌号</span>
                        </div>
                    </div>
                    <div class="blank30"></div>

                    <div class="braContent">

                    </div>
                    <div class="blank30"></div>
                    <div class="blank30"></div>

                    <div class="blank30"></div><div class="blank10"></div>
                    <div class="customRow"><a class="customLink" href="/mobadmin/brand/add">没有牌号？请自定义牌号</a></div>
                    <div class="zimuNav">
                        <a href="javascript:void(0)">A</a>
                        <a href="javascript:void(0)">B</a>
                        <a href="javascript:void(0)">C</a>
                        <a href="javascript:void(0)">D</a>
                        <a href="javascript:void(0)">E</a>
                        <a href="javascript:void(0)">F</a>
                        <a href="javascript:void(0)">G</a>
                        <a href="javascript:void(0)">H</a>
                        <a href="javascript:void(0)">I</a>
                        <a href="javascript:void(0)">J</a>
                        <a href="javascript:void(0)">K</a>
                        <a href="javascript:void(0)">L</a>
                        <a href="javascript:void(0)">M</a>
                        <a href="javascript:void(0)">N</a>
                        <a href="javascript:void(0)">O</a>
                        <a href="javascript:void(0)">P</a>
                        <a href="javascript:void(0)">Q</a>
                        <a href="javascript:void(0)">R</a>
                        <a href="javascript:void(0)">S</a>
                        <a href="javascript:void(0)">T</a>
                        <a href="javascript:void(0)">U</a>
                        <a href="javascript:void(0)">V</a>
                        <a href="javascript:void(0)">W</a>
                        <a href="javascript:void(0)">X</a>
                        <a href="javascript:void(0)">Y</a>
                        <a href="javascript:void(0)">Z</a>
                    </div>
                    <div class="zimuTishi ">A</div>
                </div>
                <ul class="bjtable">
                    <li class="tb_head">
                        <span class="w45">品名/厂家/牌号</span>
                        <span class="w28">单价<em>（元/吨）</em></span>
                        <span class="w27">供应数量<em>（吨）</em></span>
                    </li>
                    <li class="blank15"></li>

                    {loop $result['items'] $k $value}

                    <li class="tb_row" data-id="{$k+1}">
                        <div class="formdata">
                            <span class="w45">
                                <div class="pinmingCol" data-tpfb="{$value[tpfb]}" data-type="{$value[type_name]}">
                                    <span class="txt_pro">{$value[product_name]}</span>
                                    /<span class="txt_fac">{$value[factory_name]}</span>
                                    /<span class="txt_bra">{$value[brand_name]}</span>
                                </div>
                            </span>
                            <span class="w28">
                                <input type="text" class="addBjInp" readonly="true" data-act="sales_price" placeholder="输入单价" oninput="focusNub(this)" value="<?php echo del0($value[sales_price])?>"/>
                            </span>
                            <span class="w27">
                                <input type="text" class="addBjInp" readonly="true" data-act="quantity" placeholder="输入数量"  oninput="focusNub(this)" value="<?php echo del0($value[quantity])?>"/>
                            </span>
                        </div>

                        <div class="btn">
                            <span class="cancel">取消</span>
                            <span class="delete">删除</span>
                        </div>

                    </li>
                    {/loop}

                </ul>
            </div>


        </div>

        <div class="">
            <a href="javascript:void(0)" class="addrowBtn" data-act="add_product" style="display: none;margin-top: 15px;">新增报价</a>
        </div>



        <?php
            if($result[head]['contact_mobile2']==''){
                $contact_mobile2_style_display="style='display:none;'";
            }
        ?>

        <form action="do_add" id="addOfferFrom">
                <div class="baojiaInfo baojiaInfoEdit">
                    <input type="hidden" name="data[offer_products]">

                    <div class="baojiaRow">
                        <div class="baojiaLeft">
                            <span class="baojiaIcon bjContactIcon"></span>
                        </div>
                        <div class="baojiaRight">
                            <input type="text" name="data[contact]" class="modifyInp" readonly="true" value="{$result[head]['contact']}" placeholder="请输入联系人" id="contactInp"/>
                        </div>
                    </div>

                    <div class="baojiaRow">

                        <div class="baojiaLeft">
                            <span class="baojiaIcon bjPhoneIcon"></span>
                        </div>

                        <div class="baojiaRight">
                            <input type="text" name="data[contact_mobile]" class="modifyInp" readonly="true" id="phoneInp1" value="{$result[head]['contact_mobile']}" oninput="focusTel(this)" placeholder="输入号码"/>

                            <?php if($result[head]['contact_mobile2']==''){ ?>
                               <span class="addPhoneBtn" id="addPhoneBtn" style="display:none;"></span>
                               <span class="delPhoneBtn" id="delPhoneBtn" style="display:none;"></span>
                            <?php }else{ ?>

                               <span class="addPhoneBtn" id="addPhoneBtn" style="display:none;"></span>
                               <span class="delPhoneBtn" id="delPhoneBtn" style="display:none;"></span>
                            <?php } ?>

                        </div>
                    </div>

                    <div class="baojiaRow phoneRow2" {$contact_mobile2_style_display}>
                        <div class="baojiaLeft">
                            <span class="baojiaIcon bjPhone2Icon"></span>
                        </div>
                        <div class="baojiaRight">
                            <input type="text" name="data[contact_mobile2]" class="modifyInp" readonly="true" id="phoneInp2" value="{$result[head]['contact_mobile2']}" oninput="focusTel(this)" placeholder="输入号码" />
                            <span class="delPhoneBtn" id="delPhoneBtn2" style="display:none;"></span>
                        </div>
                    </div>


                    <div class="baojiaRow">
                        <div class="baojiaLeft">
                            <span class="baojiaIcon bjCompanyIcon"></span>
                        </div>
                        <div class="baojiaRight">
                            <input type="text" name="data[company_name]" class="modifyInp" readonly="true" id="company_name" value="{$result[head]['company_name']}"  placeholder="输入名称"/>
                        </div>
                    </div>

                    <div class="baojiaRow">
                        <div class="baojiaLeft">
                            <span class="baojiaIcon bjAddrIcon"></span>
                        </div>
                        <div class="baojiaRight">
                            <input type="text" name="data[delivery_place]" class="modifyInp" readonly="true" value="{$result[head]['delivery_place']}" placeholder="XX省/XX市/XX"/>
                        </div>
                    </div>

                </div>

                <div class="blank30"></div>

                <div class="">
                    <a href="javascript:void(0)" class="modifyBtn">修改</a>
                    <a href="javascript:void(0)" data-act="do_add" class="modifyBtn saveBtn" style="display:none;">保存</a>

                </div>
        </form>
        <div class="blank30"></div>



<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="/res/offer/js/jweixin-min.js"></script>

<!--footer section start-->
{include mobadmin.inc.footer}
<!--footer section end-->
<script type="text/html" id="lookTemp">
    <li class="tb_row" data-id="{[data_id]}">
        <div class="formdata">
            <span class="w45"><div class="pinmingCol" data-tpfb="" data-type=""><span class="txt_pro">品名</span>/<span class="txt_fac">厂家</span>/<span class="txt_bra">牌号</span></div></span>
            <span class="w28"> <input type="text" class="addBjInp" data-act="sales_price" placeholder="输入单价" oninput="focusNub(this)"/> </span>
            <span class="w27"> <input type="text" class="addBjInp" data-act="quantity" placeholder="输入数量"  oninput="focusNub(this)"/> </span>
        </div>
        <div class="btn">
            <span class="cancel">取消</span>
            <span class="delete">删除</span>
        </div>
    </li>

</script>
<?php if($shareSuccessPanel=='1'){ ?>
<script type="text/javascript">

    $(".shareSuccessPanel").show();
</script>
<?php } ?>
<script type="text/javascript">


    var offer_id = "{$offer_id}";
    seajs.use("offer_detail",function (exports){
        exports.init("{$item['auto_add_brand']['data_id']}","{$item['auto_add_brand']['product_name']}",
                    "{$item['auto_add_brand']['factory_name']}","{$item['auto_add_brand']['brand_name']}","{$item['auto_add_brand']['tpfb']}","{$item['auto_add_brand']['type_name']}");
        // 注册微信分享接口
        weiXin({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '{$token.appId}', // 必填，公众号的唯一标识
            timestamp: "{$token.timestamp}", // 必填，生成签名的时间戳
            nonceStr: '{$token.nonceStr}', // 必填，生成签名的随机串
            signature: '{$token.signature}',// 必填，签名，见附录1
            title: "好料、有料，你想要的都在这里！来自{$result[head]['contact']}的报价分享：", // 分享标题
            desc: "{$first_offer_decs}", // 分享描述
            link: '{$token.url}', // 分享链接
            imgUrl: window.location.origin+"/res/offer/img/wx_share.jpg" // 分享图标
        });
    });
    $("#addPhoneBtn").click(function(){
        $(".phoneRow2").show();
        $("#addPhoneBtn").hide();
        $("#delPhoneBtn").show();
    });
    $("#delPhoneBtn").click(function(){
        $("#phoneInp1").val($("#phoneInp2").val());
        $("#phoneInp2").val("");
        $("#addPhoneBtn").show();
        $("#delPhoneBtn").hide();
        $(".phoneRow2").hide();

    });
    $("#delPhoneBtn2").click(function(){

        $("#phoneInp2").val("");
        $("#addPhoneBtn").show();
        $("#delPhoneBtn").hide();
        $(".phoneRow2").hide();
    });
    $(".shareSuccessPanel").click(function(){
        $(".shareSuccessPanel").hide();
    });
    function focusNub(me){
        var val = $(me).val().toString();
        //if(val.length != val.replace(/[^\d\.]+/g,"").substring(0,8).length){
            $(me).val(val.replace(/[^\d\.]+/g,"").substring(0,8));
        //}
    }
    function focusTel(me){
        var val = $(me).val().toString();
        $(me).val(val.replace(/[^\d\-]+/g,""));
    }



</script>
